﻿using UnityEngine;
using UnityEngine.Tilemaps;

public class TerrainTileScript : MonoBehaviour
{
    public TileBase PBricks;
    // Use this for initialization
    void Start ()
	{
	    gameObject.AddComponent<Grid>();

        GameObject map = new GameObject
        {
            name = $"Tilemap"
        };
        map.transform.SetParent(transform);

	    Tilemap tileMap = map.AddComponent<Tilemap>();
	    map.AddComponent<TilemapRenderer>();

	    for (int x = 0; x < 2; x++)
	    {
	        for (int y = 0; y < 2; y++)
	        {
	            tileMap.SetTile(new Vector3Int(x, y, 0), PBricks);
	        }
	    }
	}
	
	// Update is called once per frame
	void Update () {
		
	}
}
